package cs236369.hw5.db.beans;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name="USER_ROLES")
public class DbUserRole implements Serializable
{
	/**
     * 
     */
    private static final long serialVersionUID = 951439464578539029L;


	@Id
	@ManyToOne
	@JoinColumn(name = "USERNAME", nullable = false)
	private DbUser user;
	
	@Id
	@Column(name = "ROLE_NAME", unique = false, nullable = false, length = 32)
	private String role;
	
	public DbUserRole()
	{
		//empty bean ctor;
	}
	public DbUserRole(DbUser user, String role)
	{
		this.user = user;
		this.role = role;
	}
	
	public DbUser getUser()
    {
	    return user;
    }

	public void setUser(DbUser user)
    {
	    this.user = user;
    }

	public String getRole()
    {
	    return role;
    }

	public void setRole(String role)
    {
	    this.role = role;
    }
}
